use fltk::{misc::InputChoice, prelude::*, *};
fn main() {
    let app = app::App::default().with_scheme(app::Scheme::Gtk);
    let mut window = window::Window::new(0, 0, 800, 600, None);
    let mut input_choice = InputChoice::new(100, 100, 100, 30, "");
    add_choice(&mut input_choice.clone());
    input_choice.set_callback(choice_changed);

    window.clone().center_screen();
    window.end();
    window.show();
    app.run().unwrap();
}

fn add_choice(input_choice: &mut InputChoice) {
    for i in 0..10 {
        input_choice.add(&(format!("内容-{}", i)));
    }
}

fn choice_changed(choice: &mut misc::InputChoice) {
    // 获取当前选中的值
    let value = choice.value().unwrap();
    // 打印选中的值
    println!("当前选中的值: {}", value);
}
